﻿@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_Form.cshtml";
}
<script src="~/Content/js/dialog/dialog.js"></script>
<script>
    var keyValue = $.request("keyValue");

    $(function () {
        if (!!keyValue) {
            $.ajax({
                url: "/UserInfo/GetFormJson",
                data: { keyValue: keyValue },
                dataType: "json",
                async: false,
                success: function (data) {
                    $("#form1").formSerialize(data);
                    $("#ActorRegion").val(data.ActorRegion);
                    if (data.Sex == 0) {
                        $("#Sex_Nan").attr("checked", "checked");
                    }
                    else {
                        $("#Sex_Nv").attr("checked", "checked");
                    }
   
                    if (data.State == 0) {
                        $("#State_Zhengchang").attr("checked", "checked");
                    }
                    else {
                        $("#State_Dongjie").attr("checked", "checked");
                    }
                }
            });
        }
    });

    function submitForm() {
        if (!$('#form1').formValid()) {
            return false;
        }
        if ($("#Sex_Nan").attr("checked") == "checked") {
            $("#Hd_Sex").val(0);
        }
        else {
            $("#Hd_Sex").val(1);
        }
        if ($("#State_Zhengchang").attr("checked") == "checked") {
            $("#Hd_State").val(0);
        }
        else {
            $("#Hd_State").val(1);
        }
        $.submitForm({
            url: "/UserInfo/SubmitForm?keyValue=" + keyValue,
            param: $("#form1").formSerialize(),
            success: function () {
                $.currentWindow().$("#gridList").trigger("reloadGrid");
            }
        })
    }
</script>
<form id="form1">
    <div style="margin-top: 10px; margin-left: 10px; margin-right: 10px;">
        <ul class="nav nav-tabs">
            <li class="active"><a href="#">基本信息</a></li>
            @*<li ><a href="#">扩展信息</a></li>*@
        </ul>
        <div style="padding-top: 20px; margin-right: 30px;">
            <table class="form">
                <tr>
                    <th class="formTitle">登录名</th>
                    <td class="formValue">
                        <input id="LoginName" name="LoginName" type="text" class="form-control required" placeholder="登录名" maxlength="20" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">密码</th>
                    <td class="formValue">
                        <input id="Password" name="Password" type="password" class="form-control required" placeholder="密码" maxlength="20" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">真实姓名</th>
                    <td class="formValue">
                        <input id="RealName" name="RealName" type="text" class="form-control required" placeholder="真实姓名" maxlength="20" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">性别</th>
                    <td class="formValue">
                        <div class="rdio">
                            <input id="Sex_Nan" name="Sex" type="radio" checked="checked"><label for="Sex_Nan">男</label>
                        </div>
                        <div class="rdio">
                            <input id="Sex_Nv" name="Sex" type="radio"><label for="Sex_Nv">女</label>
                        </div>
                        <input type="hidden" id="Hd_Sex">
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">电话</th>
                    <td class="formValue">
                        <input id="Phone" name="Phone" type="text" class="form-control required" placeholder="电话" maxlength="20" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">地址</th>
                    <td class="formValue">
                        <input id="Address" name="Address" type="text" class="form-control required" placeholder="地址" maxlength="50" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">状态</th>
                    <td class="formValue">
                        <div class="rdio">
                            <input id="State_Zhengchang" name="State" type="radio" checked="checked"><label for="State_Zhengchang">启用</label>
                        </div>
                        <div class="rdio">
                            <input id="State_Dongjie" name="State" type="radio"><label for="State_Dongjie">禁用</label>
                        </div>
                        <input type="hidden" id="Hd_State">
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">添加者</th>
                    <td class="formValue">
                        <input id="CreateUser" name="CreateUser" type="text" class="form-control" placeholder="添加者" readonly="readonly" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">添加时间</th>
                    <td class="formValue">
                        <input id="CreateTime" name="CreateTime" type="text" class="form-control" placeholder="添加时间" readonly="readonly" />
                    </td>
                </tr>
            </table>
        </div>
    </div>
</form>
